package com.jkl.controller.projectNew;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jkl.entity.BaseResponseDTO;
import com.jkl.entity.projectNew.po.PRojectNew;
import com.jkl.service.project.inter.IPJProjectService;
import com.jkl.service.projectNew.inter.IProjectNewService;

import lombok.extern.slf4j.Slf4j;

/**
 * 
 * <p>
 * 123开放层接口
 * <p>
 * <p>
 * 变更说明：wangjingxiang 2017年12月28日 123 增加新增、更新、删除方法
 * <p>
 * Date:2018年10月19日
 * 
 * @author ji.k
 * @version 1.0
 */
@RestController
@RequestMapping("/jky/importproject")
@Slf4j
public class ProjectNewControllerV1 {

	@Autowired
	private HttpServletRequest request;

	@Autowired
	private IProjectNewService pRojectNewServiceInterface;
	@GetMapping("/queryNewProjectByDeptId")
	public BaseResponseDTO queryNewProjectByDeptId(@RequestParam(value = "deptId") String deptId) {
		BaseResponseDTO returnDTO = new BaseResponseDTO();
		List<PRojectNew> projectNewList = pRojectNewServiceInterface.queryNewProjectByDeptId(deptId);
		JSONObject jo = new JSONObject();
		jo.put("projectNewList", (JSONArray) JSONArray.toJSON(projectNewList));
		returnDTO.setReturnData(jo);
		return returnDTO;
	}
	@GetMapping("/queryNewProjectByPermitCode")
	public BaseResponseDTO queryNewProjectByPermitCode(@RequestParam(value = "permitCode") String permitCode) {
		return pRojectNewServiceInterface.queryNewProjectByPermitCode(permitCode);
	}

}